home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Essentials / Developer Essentials May91 / MPW Interfaces & Libraries 3.2 / PInterfaces / SoundInput.p < prev    next >
Encoding:
Text File  |  1991-04-17  |  6.1 KB  |  178 lines  |  [TEXT/MPS ]

  1. {
  2. Created: Wednesday, June 27, 1990 at 6:42 PM
  3.     SoundInput.p
  4.     Pascal Interface to the Macintosh Libraries
  5.  
  6.         Copyright Apple Computer, Inc. 1989-1990
  7.         All rights reserved
  8. }
  9.  
  10.  
  11. {$IFC UNDEFINED UsingIncludes}
  12. {$SETC UsingIncludes := 0}
  13. {$ENDC}
  14.  
  15. {$IFC NOT UsingIncludes}
  16.     UNIT SoundInput;
  17.     INTERFACE
  18. {$ENDC}
  19.  
  20. {$IFC UNDEFINED UsingSoundInput}
  21. {$SETC UsingSoundInput := 1}
  22.  
  23. {$I+}
  24. {$SETC SoundInputIncludes := UsingIncludes}
  25. {$SETC UsingIncludes := 1}
  26. {$IFC UNDEFINED UsingTypes}
  27. {$I $$Shell(PInterfaces)Types.p}
  28. {$ENDC}
  29. {$IFC UNDEFINED UsingDialogs}
  30. {$I $$Shell(PInterfaces)Dialogs.p}
  31. {$ENDC}
  32. {$IFC UNDEFINED UsingFiles}
  33. {$I $$Shell(PInterfaces)Files.p}
  34. {$ENDC}
  35. {$SETC UsingIncludes := SoundInputIncludes}
  36.  
  37.  
  38. CONST
  39.  
  40. siDeviceIsConnected =     1;                { input device is connected and ready for input }
  41. siDeviceNotConnected =     0;                { input device is not connected }
  42. siDontKnowIfConnected =    -1;                { can't tell if input device is connected }
  43.  
  44. siReadPermission =         0;                { permission passed to SPBOpenDevice }
  45. siWritePermission =      1;                { permission passed to SPBOpenDevice }
  46.  
  47. { Info Selectors for Sound Input Drivers }
  48.  
  49. siDeviceConnected =        'dcon';            { input device connection status }
  50. siAGCOnOff =            'agc ';            { automatic gain control state }
  51. siPlayThruOnOff    =        'plth';            { playthrough state }
  52. siTwosComplementOnOff =    'twos';            { two's complement state }
  53. siLevelMeterOnOff =        'lmet';            { level meter state }
  54. siRecordingQuality =    'qual';            { recording quality }
  55. siVoxRecordInfo    =        'voxr';            { VOX record parameters }
  56. siVoxStopInfo =            'voxs';            { VOX stop parameters }
  57. siNumberChannels =        'chan';            { current number of channels }
  58. siSampleSize =            'ssiz';            { current sample size }
  59. siSampleRate =            'srat';            { current sample rate }
  60. siCompressionType =        'comp';            { current compression type }
  61. siCompressionFactor    =    'cmfa';            { current compression factor }
  62. siCompressionHeader    =    'cmhd';            { return compression header }
  63. siDeviceName =            'name';            { input device name }
  64. siDeviceIcon =            'icon';            { input device icon }
  65. siDeviceBufferInfo =    'dbin';            { size of interrupt buffer }
  66. siSampleSizeAvailable =    'ssav';            { sample sizes available }
  67. siSampleRateAvailable =    'srav';            { sample rates available }
  68. siCompressionAvailable ='cmav';            { compression types available }
  69. siChannelAvailable =    'chav';            { number of channels available }
  70. siAsync    =                'asyn';            { asynchronous capability }
  71. siOptionsDialog =        'optd';            { display options dialog }
  72. siContinuous =             'cont';            { continous recording }
  73. siActiveChannels =         'chac';            { active channels }
  74. siActiveLevels =         'lmac';            { active meter levels }
  75. siInitializeDriver =    'init';            { reserved for internal use only }
  76. siCloseDriver =            'clos';            { reserved for internal use only }
  77. siPauseRecording =        'paus';            { reserved for internal use only }
  78. siUserInterruptProc    =    'user';            { reserved for internal use only }
  79.  
  80. { Qualities }
  81.  
  82. siBestQuality =            'best';
  83. siBetterQuality =        'betr';
  84. siGoodQuality =            'good';
  85.  
  86.  
  87. TYPE
  88.  
  89. SPBPtr = ^SPB;
  90. SPB = RECORD
  91.     inRefNum:            LONGINT;            { reference number of sound input device }
  92.     count:                LONGINT;            { number of bytes to record }
  93.     milliseconds:        LONGINT;            { number of milliseconds to record }
  94.     bufferLength:        LONGINT;            { length of buffer in bytes }
  95.     bufferPtr:            Ptr;                { buffer to store sound data in }
  96.     completionRoutine:    ProcPtr;            { completion routine }
  97.     interruptRoutine:    ProcPtr;            { interrupt routine }
  98.     userLong:            LONGINT;            { user-defined field }
  99.     error:                OSErr;                { error }
  100.     unused1:            LONGINT;            { reserved - must be zero }
  101.     END;
  102.  
  103.  
  104. FUNCTION SPBVersion : NumVersion;
  105.     INLINE $203C,$0000,$0014,$A800;
  106.  
  107. FUNCTION SndRecord(filterProc: ModalFilterProcPtr; corner: Point; quality: OSType;
  108.     VAR sndHandle: Handle) : OSErr;
  109.     INLINE $203C,$0804,$0014,$A800;
  110.  
  111. FUNCTION SndRecordToFile(filterProc: ModalFilterProcPtr; corner: Point; quality: OSType;
  112.     fRefNum: INTEGER) : OSErr;
  113.     INLINE $203C,$0708,$0014,$A800;
  114.  
  115. FUNCTION SPBSignInDevice(deviceRefNum: INTEGER; deviceName: Str255) : OSErr;
  116.     INLINE $203C,$030C,$0014,$A800;
  117.  
  118. FUNCTION SPBSignOutDevice(deviceRefNum: INTEGER) : OSErr;
  119.     INLINE $203C,$0110,$0014,$A800;
  120.  
  121. FUNCTION SPBGetIndexedDevice(count: INTEGER; VAR deviceName: Str255;
  122.     VAR deviceIconHandle: Handle) : OSErr;
  123.     INLINE $203C,$0514,$0014,$A800;
  124.  
  125. FUNCTION SPBOpenDevice(deviceName: Str255; permission: INTEGER; VAR inRefNum: LONGINT) : OSErr;
  126.     INLINE $203C,$0518,$0014,$A800;
  127.  
  128. FUNCTION SPBCloseDevice(inRefNum: LONGINT) : OSErr;
  129.     INLINE $203C,$021C,$0014,$A800;
  130.  
  131. FUNCTION SPBRecord(inParamPtr: SPBPtr; asynchFlag: BOOLEAN) : OSErr;
  132.     INLINE $203C,$0320,$0014,$A800;
  133.  
  134. FUNCTION SPBRecordToFile(fRefNum: INTEGER; inParamPtr: SPBPtr; asynchFlag: BOOLEAN) : OSErr;
  135.     INLINE $203C,$0424,$0014,$A800;
  136.  
  137. FUNCTION SPBPauseRecording(inRefNum: LONGINT) : OSErr;
  138.     INLINE $203C,$0228,$0014,$A800;
  139.  
  140. FUNCTION SPBResumeRecording(inRefNum: LONGINT) : OSErr;
  141.     INLINE $203C,$022C,$0014,$A800;
  142.  
  143. FUNCTION SPBStopRecording(inRefNum: LONGINT) : OSErr;
  144.     INLINE $203C,$0230,$0014,$A800;
  145.  
  146. FUNCTION SPBGetRecordingStatus(inRefNum: LONGINT; VAR recordingStatus: INTEGER; VAR meterLevel: INTEGER;
  147.     VAR totalSamplesToRecord: LONGINT; VAR numberOfSamplesRecorded: LONGINT;
  148.     VAR totalMsecsToRecord: LONGINT; VAR numberOfMsecsRecorded: LONGINT) : OSErr;
  149.     INLINE $203C,$0E34,$0014,$A800;
  150.  
  151. FUNCTION SPBGetDeviceInfo(inRefNum: LONGINT; infoType: OSType; infoData: Ptr) : OSErr;
  152.     INLINE $203C,$0638,$0014,$A800;
  153.  
  154. FUNCTION SPBSetDeviceInfo(inRefNum: LONGINT; infoType: OSType; infoData: Ptr) : OSErr;
  155.     INLINE $203C,$063C,$0014,$A800;
  156.  
  157. FUNCTION SPBMillisecondsToBytes(inRefNum: LONGINT; VAR milliseconds: LONGINT) : OSErr;
  158.     INLINE $203C,$0440,$0014,$A800;
  159.  
  160. FUNCTION SPBBytesToMilliseconds(inRefNum: LONGINT; VAR byteCount: LONGINT) : OSErr;
  161.     INLINE $203C,$0444,$0014,$A800;
  162.  
  163. FUNCTION SetupSndHeader(sndHandle: Handle; numChannels: INTEGER; sampleRate: Fixed;
  164.                 sampleSize: INTEGER; compressionType: OSType; baseNote: INTEGER;
  165.                 numBytes: LONGINT; VAR headerLen: INTEGER) : OSErr;
  166.     INLINE $203C,$0D48,$0014,$A800;
  167.  
  168. FUNCTION SetupAIFFHeader(fRefNum: INTEGER;  numChannels: INTEGER; sampleRate: Fixed;
  169.                 sampleSize: INTEGER; compressionType: OSType;
  170.                 numBytes: LONGINT; numFrames: LONGINT) : OSErr;
  171.     INLINE $203C,$0B4C,$0014,$A800;
  172.  
  173. {$ENDC}    { UsingSoundInput }
  174.  
  175. {$IFC NOT UsingIncludes}
  176.     END.
  177. {$ENDC}
  178.